//
//  UIBarButtonItem+XM.m
//  XMWeibo
//
//  Created by chi on 14-8-21.
//  Copyright (c) 2014年 xiaoming. All rights reserved.
//

#import "UIBarButtonItem+XM.h"

@implementation UIBarButtonItem (XM)



+ (UIBarButtonItem *)barButtonItemWithNormalImage:(NSString *)normal highlighted:(NSString *)highlighted target:(id)target action:(SEL)action
{
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setBackgroundImage:[UIImage adaptIOS7ImageWithName:normal] forState:UIControlStateNormal];
    [button setBackgroundImage:[UIImage adaptIOS7ImageWithName:highlighted] forState:UIControlStateHighlighted];
    button.bounds = (CGRect){CGPointZero, button.currentBackgroundImage.size};
    [button addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
    
    return [[UIBarButtonItem alloc]initWithCustomView:button];

}

@end
